package com.yayun.merchant.service.impl;

import java.util.List;
import com.yayun.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yayun.merchant.mapper.PmsCategoryMapper;
import com.yayun.merchant.domain.PmsCategory;
import com.yayun.merchant.service.IPmsCategoryService;

/**
 * 图书分类Service业务层处理
 * 
 * @author kk
 * @date 2024-12-05
 */
@Service
public class PmsCategoryServiceImpl implements IPmsCategoryService 
{
    @Autowired
    private PmsCategoryMapper pmsCategoryMapper;

    /**
     * 查询图书分类
     * 
     * @param id 图书分类主键
     * @return 图书分类
     */
    @Override
    public PmsCategory selectPmsCategoryById(Long id)
    {
        return pmsCategoryMapper.selectPmsCategoryById(id);
    }

    /**
     * 查询图书分类列表
     * 
     * @param pmsCategory 图书分类
     * @return 图书分类
     */
    @Override
    public List<PmsCategory> selectPmsCategoryList(PmsCategory pmsCategory)
    {
        return pmsCategoryMapper.selectPmsCategoryList(pmsCategory);
    }

    /**
     * 新增图书分类
     * 
     * @param pmsCategory 图书分类
     * @return 结果
     */
    @Override
    public int insertPmsCategory(PmsCategory pmsCategory)
    {
        pmsCategory.setCreateTime(DateUtils.getNowDate());
        return pmsCategoryMapper.insertPmsCategory(pmsCategory);
    }

    /**
     * 修改图书分类
     * 
     * @param pmsCategory 图书分类
     * @return 结果
     */
    @Override
    public int updatePmsCategory(PmsCategory pmsCategory)
    {
        pmsCategory.setUpdateTime(DateUtils.getNowDate());
        return pmsCategoryMapper.updatePmsCategory(pmsCategory);
    }

    /**
     * 批量删除图书分类
     * 
     * @param ids 需要删除的图书分类主键
     * @return 结果
     */
    @Override
    public int deletePmsCategoryByIds(Long[] ids)
    {
        return pmsCategoryMapper.deletePmsCategoryByIds(ids);
    }

    /**
     * 删除图书分类信息
     * 
     * @param id 图书分类主键
     * @return 结果
     */
    @Override
    public int deletePmsCategoryById(Long id)
    {
        return pmsCategoryMapper.deletePmsCategoryById(id);
    }

    /**
     * 查询指定父分类的子分类列表
     * 
     * @param parentId 父分类ID
     * @return 子分类列表
     */
    @Override
    public List<PmsCategory> selectPmsCategoryByParentId(Long parentId)
    {
        return pmsCategoryMapper.selectPmsCategoryByParentId(parentId);
    }
} 